﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using InstituteManager.Data;
using InstituteManager.Bussiness;

namespace InstituteManager
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            showCompetitionInfo();
        }

        protected void showCompetitionInfo()
        {
            string html = "";
            foreach(tbl_Competition com in CompetitionBL.getUpcomming())
                html += "<li><a href=\"/viewCompetition.aspx?compe=" + com.CompetitionId + "\" class=\"bottom\">" + com.CompetitionName + " (" + com.StartDate.Value.ToString("d") + " - " + com.EndDate.Value.ToString("d") + " )</a></li>";
            if (html == "")
                html = "No Upcomming Competitions";
            lblUpcomingCompetition.Text = html;


            html = "";
            foreach (tbl_Competition com in CompetitionBL.getOngoing())
                html += "<li><a href=\"/viewCompetition.aspx?compe=" + com.CompetitionId + "\" class=\"bottom\">" + com.CompetitionName + " (" + com.StartDate.Value.ToString("d") + " - " + com.EndDate.Value.ToString("d") + " )</a></li>";
            if (html == "")
                html = "No Ongoing Competitions";
            lblOngoingCompetition.Text = html;

            html = "";
            foreach (tbl_Competition com in AwardIssuedBL.getCompetitionAwarded())
                html += "<li><a href=\"/viewCompetition.aspx?compe=" + com.CompetitionId + "\" class=\"bottom\">" + com.CompetitionName + " (" + com.StartDate.Value.ToString("d") + " - " + com.EndDate.Value.ToString("d") + " )</a></li>";
            if (html == "")
                html = "No Competitions Awarded";
            lblCompetitionAwarded.Text = html;
        }
    }
}